
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options

# 创建ChromeOptions对象
opt = Options()
# 添加detach选项，使浏览器在脚本执行完毕后继续运行
opt.add_experimental_option('detach', False)
path = 'chromedriver.exe'

browser = webdriver.Chrome(service=Service(path), options=opt)
#
url = 'https://www.jd.com'
#
browser.get(url)

content = browser.page_source
print(content)
